home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 9.0 KB | 268 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: DrawSel.h
- // Release Version: $ 1.0d11 $
- //
- // Author: Henri Lamiraux
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef DRAWSEL_H
- #define DRAWSEL_H
-
- // ----- Part Layer -----
-
- #ifndef FWSLCING_H
- #include "FWSlcing.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWRECSHP_H
- #include "FWRecShp.h"
- #endif
-
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma import on
- #endif
- class FW_CLASS_ATTR FW_CGraphicContext;
- class FW_CLASS_ATTR FW_CMouseEvent;
- class FW_CLASS_ATTR FW_PPattern;
- class FW_CLASS_ATTR FW_CColor;
- class FW_CLASS_ATTR FW_CPrivOrderedCollection;
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma import off
- #endif
-
- class FW_CLASS_ATTR CDrawPart;
- class FW_CLASS_ATTR CDrawFrame;
- class FW_CLASS_ATTR CSelectionIterator;
- class FW_CLASS_ATTR CDrawSelection;
- class FW_CLASS_ATTR CBaseShape;
-
- //========================================================================================
- // class CDrawSelection
- //========================================================================================
-
- class FW_CLASS_ATTR CDrawSelection : public FW_CEmbeddingSelection
- {
- //----------------------------------------------------------------------------------------
- // Initialization/Destruction
- //
- public:
- CDrawSelection(Environment* ev, CDrawPart* drawPart);
- virtual ~CDrawSelection();
-
- //----------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- virtual void CloseSelection(Environment* ev);
- virtual void SelectAll(Environment* ev);
- virtual FW_Boolean IsEmpty(Environment* ev) const;
- virtual FW_Boolean ClearSelection(Environment* ev);
- virtual FW_MProxy* IsSelectionOnlyOneProxy(Environment* ev) const;
-
- virtual ODShape* CreateSelectionFrameShape(Environment* ev) const;
-
- virtual ODShape* CreateSelectionShape(Environment* ev, ODFacet* facet, FW_CFrame* frame) const;
- virtual ODShape* CreateSelectionOutline(Environment* ev, ODFacet* facet, FW_CFrame* frame) const;
-
- virtual void DoExternalizeSelection(Environment* ev,
- ODStorageUnit* destinationSU,
- FW_CCloneInfo* cloneInfo);
- virtual FW_Boolean DoInternalizeSelection(Environment* ev,
- ODStorageUnit* storageUnit,
- FW_CCloneInfo* cloneInfo);
-
- virtual FW_Boolean CanSubscribe(Environment* ev, ODPasteAsMergeSetting& setting);
- virtual FW_Boolean IsSelectionPublishable(Environment* ev);
-
- virtual FW_Boolean InsertNewPart(Environment* ev, FW_CFrame* scopeFrame);
-
- virtual FW_CPromise* NewPromise(Environment* ev,
- ODUpdateID updateID,
- FW_EStorageKinds storageKind,
- FW_CFrame* scopeFrame,
- ODCloneKind cloneKind);
-
- virtual FW_Boolean IsMouseInDraggableItem(Environment* ev,
- FW_CFrame* frame,
- const FW_CMouseEvent& theMouseEvent,
- FW_Boolean inBackground);
-
- virtual void UpdateSelectionOnMouseDown(Environment* ev,
- const FW_CMouseEvent& mouseEvent,
- ODFacet* embeddedFacet,
- FW_Boolean inEmbeddedFrameBorder,
- FW_Boolean inBackground);
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- CBaseShape* WhichHandle(Environment* ev, FW_CGraphicContext& gc, const FW_CPoint& mouse, short& whichHandle) const;
-
- void RenderSelectionHandles(Environment* ev, FW_CGraphicContext& gc);
- void RenderHandles(Environment* ev, CBaseShape* shape);
- void RenderAllHandles(Environment* ev, FW_CFrame* frame);
-
- void AddToSelection(Environment* ev, CBaseShape* theShape, FW_Boolean renderHandles);
- void RemoveFromSelection(Environment* ev, CBaseShape* theShape, FW_Boolean renderHandles);
-
- void MapSelection(Environment* ev, const FW_CRect& srcRect, const FW_CRect& dstRect);
- void OffsetSelection(Environment* ev, FW_CFixed xDelta, FW_CFixed yDelta);
-
- FW_Boolean Resize(Environment* ev, const FW_CMouseEvent& theMouseEvent);
-
- void SelectWithRectangle(Environment* ev, const FW_CMouseEvent& theMouseEvent);
-
- FW_Boolean GetSelectionPenSize(Environment* ev, FW_CFixed& penSize);
-
- void ChangeSelectionPenSize(Environment* ev, FW_CFixed newPenSize);
- void ChangeSelectionRenderVerb(Environment* ev, unsigned short newRenderVerb);
-
- void ChangeSelectionColor(Environment* ev, const FW_CColor& color, FW_Boolean changeFill);
- void ChangeSelectionPattern(Environment* ev, const FW_PPattern& pattern, FW_Boolean changeFill);
-
- FW_CPoint AdjustSelectionAfterPaste(Environment* ev, FW_CFrame* scopeFrame);
-
- FW_Boolean HasProxySelected() const;
-
- unsigned long Count() const;
-
- // ----- Frozen state -----
- FW_Boolean HasFrozen() const;
- FW_Boolean HasNotFrozen() const;
- void SetFrozen(Environment* ev, FW_Boolean state);
-
- ODShape* GetUpdateShape() const;
- void GetDragRect(FW_CRect& dragRect) const;
-
- void RedrawShape(Environment* ev, CBaseShape *shape);
-
- // ----- Anchor Shape -----
- CBaseShape* GetAnchorShape() const;
- void SetAnchorShape(CBaseShape* shape);
-
-
- // ----- Linking -----
- void SelectionChanged(Environment* ev);
- void DeleteSelection(Environment* ev);
- FW_Boolean IsOKtoEdit(Environment* ev);
-
- // ----- Selection Collection -----
- FW_CPrivOrderedCollection* GetSelectionCollection() const;
-
- private:
- void CalcCache(Environment* ev);
-
- void DoAdd(Environment* ev, CBaseShape *shape);
- void DoRemove(Environment* ev, CBaseShape *shape);
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- private:
- CDrawPart* fDrawPart;
- FW_CRect fDragRect;
- ODShape* fUpdateShape;
- unsigned short fProxyShapeCount;
- unsigned short fFrozenCount;
- unsigned long fCount;
- CBaseShape* fAnchorShape;
- short fClickedHandle;
-
- FW_CPrivOrderedCollection* fCollection;
-
- FW_CRectShape fWorkingHandle;
- };
-
- //========================================================================================
- // CDrawSelection Inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::HasProxySelected
- //----------------------------------------------------------------------------------------
- inline FW_Boolean CDrawSelection::HasProxySelected() const
- {
- return fProxyShapeCount != 0;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::GetUpdateShape
- //----------------------------------------------------------------------------------------
- inline ODShape* CDrawSelection::GetUpdateShape() const
- {
- return fUpdateShape;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::GetDragRect
- //----------------------------------------------------------------------------------------
- inline void CDrawSelection::GetDragRect(FW_CRect& dragRect) const
- {
- dragRect = fDragRect;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::HasFrozen
- //----------------------------------------------------------------------------------------
- inline FW_Boolean CDrawSelection::HasFrozen() const
- {
- return fFrozenCount != 0;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::HasNotFrozen
- //----------------------------------------------------------------------------------------
- inline FW_Boolean CDrawSelection::HasNotFrozen() const
- {
- return fCount != 0 && fFrozenCount != fCount;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::Count
- //----------------------------------------------------------------------------------------
- inline unsigned long CDrawSelection::Count() const
- {
- return fCount;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::GetAnchorShape
- //----------------------------------------------------------------------------------------
- inline CBaseShape* CDrawSelection::GetAnchorShape() const
- {
- return fAnchorShape;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::SetAnchorShape
- //----------------------------------------------------------------------------------------
- inline void CDrawSelection::SetAnchorShape(CBaseShape* shape)
- {
- fAnchorShape = shape;
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawSelection::GetSelectionCollection
- //----------------------------------------------------------------------------------------
- inline FW_CPrivOrderedCollection* CDrawSelection::GetSelectionCollection() const
- {
- return fCollection;
- }
-
- #endif